package query;

import java.util.Vector;

import document.InvertedIndex;

import document.VectorSpaceRetrieval;


/**
 * Allows searches which uses the vector space model
 * @author severin
 *
 */
public class VectorTerm extends Term
{

	public VectorTerm(String name) {
		super(name);
	}

	@Override
	public void process(InvertedIndex i) 
	{		
		VectorSpaceRetrieval vc = new VectorSpaceRetrieval(i);
		vc.searchSimilar(getName());
		queryResult = vc.getSimilarDocuments();
	}
	
	public void processWithRelevanceFeedback(InvertedIndex i, double weightOldQuery, double weightRelevant, double weightIrrelevant) {
		VectorSpaceRetrieval vc = new VectorSpaceRetrieval(i);
		Vector<Integer> relevantIds = new Vector<Integer>();
		relevantIds.add(queryResult.get(0));
		Vector<Integer> irrelevantIds = new Vector<Integer>();
		vc.searchWithRelevance(getName(), relevantIds, irrelevantIds, weightOldQuery, weightRelevant, weightIrrelevant);

		queryResult = vc.getSimilarDocuments();
	}
	
	
}
